name: pre-commit run_id: commands[0] env HOME: /home/jenkins env LANG: C.UTF-8 env PATH: /w/workspace/docs-tox-verify-vanadium/.tox/pre-commit/bin:/opt/pyenv/bin:/tmp/venv-s0m3/bin:/opt/pyenv/shims:/home/jenkins/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin env PIP_DISABLE_PIP_VERSION_CHECK: 1 env PYTHONHASHSEED: 929465754 env PYTHONIOENCODING: utf-8 env SSH_AUTH_SOCK: ******************************** env TOX_ENV_DIR: /w/workspace/docs-tox-verify-vanadium/.tox/pre-commit env TOX_ENV_NAME: pre-commit env TOX_WORK_DIR: /w/workspace/docs-tox-verify-vanadium/.tox env VIRTUAL_ENV: /w/workspace/docs-tox-verify-vanadium/.tox/pre-commit env __TOX_ENVIRONMENT_VARIABLE_ORIGINAL_CI: true metadata pid: 2286 cwd: /w/workspace/docs-tox-verify-vanadium allow: /w/workspace/docs-tox-verify-vanadium/.tox/pre-commit/bin/* cmd: pre-commit run --all-files --show-diff-on-failure exit_code: 1 [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks. [INFO] Initializing environment for https://github.com/jorisroovers/gitlint. [INFO] Initializing environment for https://github.com/jorisroovers/gitlint:./gitlint-core[trusted-deps]. [INFO] Initializing environment for https://github.com/adrienverge/yamllint.git. [INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy. [INFO] Initializing environment for https://github.com/shellcheck-py/shellcheck-py. [INFO] Initializing environment for https://github.com/igorshubovych/markdownlint-cli. [INFO] Initializing environment for https://github.com/Mateusz-Grzelinski/actionlint-py. [INFO] Initializing environment for https://github.com/codespell-project/codespell. [INFO] Initializing environment for https://github.com/python-jsonschema/check-jsonschema. [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/adrienverge/yamllint.git. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/pre-commit/mirrors-mypy. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/shellcheck-py/shellcheck-py. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/igorshubovych/markdownlint-cli. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/Mateusz-Grzelinski/actionlint-py. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/codespell-project/codespell. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/python-jsonschema/check-jsonschema. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... trim trailing whitespace.................................................Passed check for added large files..............................................Passed check python ast.........................................................Passed check json...........................................(no files to check)Skipped check for merge conflicts................................................Passed check xml............................................(no files to check)Skipped check yaml...............................................................Passed debug statements (python)................................................Passed fix end of files.........................................................Passed fix requirements.txt.....................................................Passed mixed line ending........................................................Passed don't commit to branch...................................................Passed yamllint.................................................................Passed mypy.....................................................................Passed shellcheck...............................................................Passed markdownlint.............................................................Failed - hook id: markdownlint - exit code: 1 - files were modified by this hook LOCAL-TESTING-README.md:3:81 MD013/line-length Line length [Expected: 80; Actual: 160] LOCAL-TESTING-README.md:56:81 MD013/line-length Line length [Expected: 80; Actual: 88] LOCAL-TESTING-README.md:148:81 MD013/line-length Line length [Expected: 80; Actual: 112] LOCAL-TESTING-README.md:166:81 MD013/line-length Line length [Expected: 80; Actual: 104] actionlint...............................................................Passed codespell................................................................Passed Validate GitHub Actions..............................(no files to check)Skipped Validate GitHub Workflows................................................Passed Check GitHub Workflows set timeout-minutes...............................Passed Validate ReadTheDocs Config..............................................Passed pre-commit hook(s) made changes. If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`. To run `pre-commit` as part of git workflow, use `pre-commit install`. All changes made by hooks: diff --git a/LOCAL-TESTING-README.md b/LOCAL-TESTING-README.md index 939ba5c74..a7fbc5ea8 100644 --- a/LOCAL-TESTING-README.md +++ b/LOCAL-TESTING-README.md @@ -5,6 +5,7 @@ This repository includes infrastructure for testing documentation builds locally ## Overview The setup provides a hybrid GitHub Actions workflow that work: + - **Locally with act**: Runs only the documentation build and link checking - **On GitHub/Gerrit**: Runs the full Gerrit verification workflow @@ -12,6 +13,7 @@ The setup provides a hybrid GitHub Actions workflow that work: 1. **Docker**: Required for act to run containers 2. **act**: Install from [nektos/act releases](https://github.com/nektos/act/releases) + ```bash # Example for Linux curl -s https://api.github.com/repos/nektos/act/releases/latest | \ @@ -22,19 +24,25 @@ The setup provides a hybrid GitHub Actions workflow that work: ## Quick Start ### Test Local Changes + Test your current working directory changes without submitting to Gerrit: + ```bash bash test-gerrit-local.sh --local-changes --job local-tox ``` ### Test Specific Gerrit Change + Test a specific Gerrit change request: + ```bash bash test-gerrit-local.sh --gerrit-url "https://git.opendaylight.org/gerrit/c/docs/+/117503" ``` ### Dry Run (Faster for Validation) + Add `--dry-run` to quickly validate the workflow without actually running the build: + ```bash bash test-gerrit-local.sh --local-changes --dry-run ``` @@ -42,12 +50,14 @@ bash test-gerrit-local.sh --local-changes --dry-run ## Configuration Files ### Core Files + - `.actrc` - Act configuration (Docker images, environment) - `.env.local` - Local environment variables for act - `.github/workflows/gerrit-verify.yaml` - Hybrid workflow (works locally and on GitHub) - `test-gerrit-local.sh` - Test script with URL parsing and event generation ### Generated Files + - `gerrit-verify-event.json` - Auto-generated workflow event payload ## Test Script Options @@ -67,6 +77,7 @@ Usage: test-gerrit-local.sh [options] ## How It Works ### Local Testing Flow + 1. **Script generates event JSON** with required workflow inputs 2. **Act runs workflow** using the `env.ACT='true'` environment variable 3. **Only local-tox job executes** - Gerrit jobs are skipped via conditionals @@ -75,11 +86,13 @@ Usage: test-gerrit-local.sh [options] - Link checking (`tox -e docs-linkcheck`) ### Gerrit Integration Flow + 1. **GitHub Actions triggers** on Gerrit events 2. **Full workflow executes** when `env.ACT != 'true'` 3. **Gerrit jobs run**: change info → tox verify → vote ### Key Features + - **Single workflow file** works both locally and on GitHub - **Environment-based branching** using `env.ACT` detection - **Minimal event JSON** with only required fields @@ -89,25 +102,31 @@ Usage: test-gerrit-local.sh [options] ## Troubleshooting ### Act Version Compatibility + Tested with act v0.2.80. Newer versions may have different YAML parsing behavior. ### Docker Permissions + Ensure your user can run Docker commands without sudo: + ```bash sudo usermod -aG docker $USER # Logout and login again ``` ### Missing Dependencies + If tox environments fail, ensure `docs/requirements.txt` is up to date. ### Workflow Parse Errors + - Check YAML indentation in `.github/workflows/gerrit-verify.yaml` - Validate with: `act --list --workflows .github/workflows/gerrit-verify.yaml` ## Example Workflows ### Daily Development + ```bash # Make changes to docs vim docs/some-file.rst @@ -120,6 +139,7 @@ git add . && git commit -m "Update documentation" && git review ``` ### Testing Specific Changes + ```bash # Test someone else's Gerrit change bash test-gerrit-local.sh --gerrit-url "https://git.opendaylight.org/gerrit/c/docs/+/117503" @@ -131,6 +151,7 @@ bash test-gerrit-local.sh --gerrit-url "https://git.opendaylight.org/gerrit/c/do ## Files Added/Modified ### New Files + - `.actrc` - Act runner configuration - `.env.local` - Local environment variables - `test-gerrit-local.sh` - Main test script @@ -138,6 +159,7 @@ bash test-gerrit-local.sh --gerrit-url "https://git.opendaylight.org/gerrit/c/do - `.pre-commit-config.yaml` - Pre-commit hooks for code quality ### Modified Files + - `.github/workflows/gerrit-verify.yaml` - Enhanced with local testing support - `docs/index.rst` - Test change (can be reverted)